﻿using System;
using System.Windows;
using PureMVC.Interfaces;
using GameEngine.Model.Data;
using System.Collections.Generic;
using GameEngine.Libs;

namespace GameEngine.Model
{
    public class IThingTypeDataProxyConstants<IdType>
        where IdType : IComparable<IdType>
    {
        public const string THINGTYPECHANGED_NOTIFICATION = "ThingTypeDataProxyChanged";
        public static string CreateDataProxyName(IThingTypeVO<IdType> typeVO)
        {
            return CreateDataProxyName(typeVO.Id);
        }

        public static string CreateDataProxyName(IThingTypeVOId id)
        {
            return id.Value + "_DataProxy";
        }
    }
    public interface IThingTypeDataProxy<IdType> : IDataProxy
        where IdType : IComparable<IdType>
    {
        string Name { get; }
        IThingTypeVOId Id { get; }

        IViewDataProxy<IdType> View { get; }
        IThingTypeVO<IdType> VO { get; }
        //Outras props

        //IThingTypeDataProxy<ItemVOId> Replicate();
    }

    public enum SensibilityRadiusEnum
    {
        forward,//forward squares
        forwardAndDiagonal,//3 forward squares
        forwardAndSides,//all above and 2 side squares
        forwardAndBackDiagonal,//all above and 2 back diagonal squares
        forwardAndBack //360
    }        
    public class ISensingThingTypeDataProxyConstants
    {

    }
    public interface ISensingThingTypeDataProxy<ItemVOId> : IThingTypeDataProxy<ItemVOId>
        where ItemVOId : IComparable<ItemVOId>
    {
        IDictionary<string, int> SensibilityReach { get; }
        IDictionary<string, SensibilityRadiusEnum> SensibilityRadius { get; }
        /// <summary>
        /// To be setted when reach, radius and senses are changed
        /// </summary>
        IDictionary<string, List<Point>> InReachMapPositionsRelative { get; }
        //priority
        List<string> Senses { get; }
        void AddSense(string name, int reach, SensibilityRadiusEnum radius);
    }

    public class IMovingThingTypeDataProxyConstants
    {

    }
    public interface IMovingThingTypeDataProxy<ItemVOId> : ISensingThingTypeDataProxy<ItemVOId>
        where ItemVOId : IComparable<ItemVOId>
    {
        /// <summary>
        /// 0..1
        /// </summary>
        float Velocity { get; set; }
    }

    public class IThinkingThingTypeDataProxyConstants
    {

    }
    public interface IThinkingThingTypeDataProxy<ItemVOId> : IMovingThingTypeDataProxy<ItemVOId>
        where ItemVOId : IComparable<ItemVOId>
    {
        float[] BrainInput(IWorldDataProxy<ItemVOId> world, IThingDataProxy<ItemVOId> item);
        void BrainOutput(IThingDataProxy<ItemVOId> item, float[] output);
    }
}